@extends('admin.index')
@section('content')
<link rel="stylesheet" href="{{ asset ('admins/css/pintuer.css ') }}">
<link rel="stylesheet" href="{{ asset ('admins/css/admin.css ') }}">
<script src="{{ asset ( 'admins/js/jquery.js ') }}"></script>
<script src="{{ asset ('admins/js/pintuer.js ') }}"></script>
<form action='{{ url("admin/category") }}' method='post' name='myform'>
    <input type='hidden' name='_token' value='{{ csrf_token() }}'>
    <input type='hidden' name='_method' value='DELETE'>
</form>
<form  class="form-x" action="{{url ('admin/category')}}">
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
  <div class="padding border-bottom">
    <button type="button" class="button border-yellow" onclick="window.location.href='#add'"><span class="icon-plus-square-o"></span> 添加分类</button>
    <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
        <input type="submit" class="button border-main icon-search" value="搜索">
  </div>
    <div >
        @if (session('msg'))
            <div class="alert alert-success">
                {{ session('msg') }}
            </div>
        @endif
    </div> 
  <table class="table table-hover text-center">
    <tr>
      <th width="10%">ID</th>
      <th width="10%">名称</td>
      <th width="15%">父类</th>
      <th width='15%'>分类图片</th>
      <th width="10%">排序</th>
      <th width="20%">操作</th>
    </tr>
    @foreach ($list as $v)
    <tr>
      <td>{{$v->id}}</td>
      <td>{{$v->name}}</td>
      <td>{{$v->pid}}</td>
      <td><img src="{{$v->img}}" alt="" width="50px"></td>
      <td>{{$v->path }}</td>
      <td>
        <a class="button border-main" href="{{ url('admin/category').'/'.$v->id }}/edit"> 修改</a> 
        <a class="button border-red" href="javascript:del( {{ $v->id }} )" ><span class="icon-trash-o"></span> 删除</a>
        <div class="button-group"><a class="button border-red" href="{{ url('admin/cateSon').'/'.$v->id }}" class='btn'><span class="icon-edit"></span>添加子类别</a></div>
    </td>
    </tr>
    @endforeach
  </table>
</div>
<script type="text/javascript">
function del(id){
	if(confirm("您确定要删除吗?")){			
		 var form = document.myform;
     form.action = '/admin/category/'+id;
     form.submit()
	}
}
</script>
<br>
{{ $list->links() }}
@stop